#include "mainwindow.h"

#include <QApplication>

#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <QDebug>
#include <unary.h>


#include "eventclient.h"

#include "routeguide.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);



    // Instantiate the client. It requires a channel, out of which the actual RPCs
    // are created. This channel models a connection to an endpoint specified by
    // the argument "--target=" which is the only expected argument.
    // We indicate that the channel isn't authenticated (use of
    // InsecureChannelCredentials()).
    std::string target_str;
    std::string arg_str("--target");
//    if (argc > 1) {
//        std::string arg_val = argv[1];
//        size_t start_pos = arg_val.find(arg_str);
//        if (start_pos != std::string::npos) {
//            start_pos += arg_str.size();
//            if (arg_val[start_pos] == '=') {
//                target_str = arg_val.substr(start_pos + 1);
//            } else {
//                std::cout << "The only correct argument syntax is --target=" << std::endl;
//                return 0;
//            }
//        } else {
//            std::cout << "The only acceptable argument is --target=" << std::endl;
//            return 0;
//        }
//    } else {
//        target_str = "localhost:6001";
//    }


    MainWindow w;
    w.show();


    //GreeterAsynClientTest();

    //RouteGuideClientTest();



    //GreeterClientTest();
    EventClientTest();

   // g_serviceCtlSession->BeginCtlStream();

    return a.exec();
}
